package com.zmn.plat.common.dictionary;

/**
 * 结算节点
 *
 * @author yangshuangping
 * @since 2021-7-1 18:07:17
 */
public enum ChannelSettleStatementChannelEnum {

    /**
     * 1不允许，2允许
     */
    ORDER_CHANNEL(ChannelSettleStatementChannelEnum.SETTLE_PLACE_AN_ORDER, "下单渠道"),
    SOURCES(ChannelSettleStatementChannelEnum.SETTLE_SOURCES, "来源渠道");

    /**
     * 1不允许
     */
    public final static int SETTLE_PLACE_AN_ORDER = 1;
    /**
     * 2允许
     */
    public final static int SETTLE_SOURCES = 2;

    private Integer code;
    private String name;

    ChannelSettleStatementChannelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getName(Integer code) {
        ChannelSettleStatementChannelEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelSettleStatementChannelEnum of(Integer code) {
        switch (code) {
            case 1:
                return ORDER_CHANNEL;
            case 2:
                return SOURCES;
            default:
                return null;
        }
    }
}
